﻿using Microsoft.Phone.BackgroundTransfer;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SpaceNeedle.x6473.WindowsPhone.Converters
{
    public class TransferStatusToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null)
            {
                return string.Empty;
            }

            TransferStatus status = (TransferStatus)value;

            switch (status)
            {
                case TransferStatus.Completed:
                    return "Enviado";
                case TransferStatus.None:
                case TransferStatus.Unknown:
                    return "Verificando Upload";
                case TransferStatus.Transferring:
                    return "Enviando";
                case TransferStatus.Paused:
                case TransferStatus.WaitingForExternalPower:
                case TransferStatus.WaitingForExternalPowerDueToBatterySaverMode:
                case TransferStatus.WaitingForNonVoiceBlockingNetwork:
                case TransferStatus.WaitingForWiFi:
                case TransferStatus.Waiting:
                    return "Aguardando Conectividade";
            }

            return string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return TransferStatus.None;
        }
    }
}
